package com.jvtd.eyl.bean.binding;

import android.databinding.BaseObservable;
import android.databinding.Bindable;
import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;
import com.jvtd.eyl.BR;

/**
 * 期刊实体
 *
 * 作者:chenlei
 * 时间:2018/11/12 4:39 PM
 */
public class PeriodicalBean extends BaseObservable implements Parcelable {
    private String id;//期刊ID
    private String img;//图片
    @SerializedName("title")
    private String name;//名称
    private String author;//作者
    /**
     * title : 安全
     * category_id : 1
     * category_name : 期刊
     */

    private String category_id;
    private String category_name;

    @Bindable
    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
        notifyPropertyChanged(BR.author);
    }

    @Bindable
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
        notifyPropertyChanged(BR.id);
    }

    @Bindable
    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
        notifyPropertyChanged(BR.img);
    }

    @Bindable
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        notifyPropertyChanged(BR.name);
    }

    public String getCategory_id() {
        return category_id;
    }

    public void setCategory_id(String category_id) {
        this.category_id = category_id;
    }

    public String getCategory_name() {
        return category_name;
    }

    public void setCategory_name(String category_name) {
        this.category_name = category_name;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.img);
        dest.writeString(this.name);
        dest.writeString(this.author);
        dest.writeString(this.category_id);
        dest.writeString(this.category_name);
    }

    public PeriodicalBean() {
    }

    protected PeriodicalBean(Parcel in) {
        this.id = in.readString();
        this.img = in.readString();
        this.name = in.readString();
        this.author = in.readString();
        this.category_id = in.readString();
        this.category_name = in.readString();
    }

    public static final Creator<PeriodicalBean> CREATOR = new Creator<PeriodicalBean>() {
        @Override
        public PeriodicalBean createFromParcel(Parcel source) {
            return new PeriodicalBean(source);
        }

        @Override
        public PeriodicalBean[] newArray(int size) {
            return new PeriodicalBean[size];
        }
    };

    @Override
    public String toString() {
        return "PeriodicalBean{" +
                "id='" + id + '\'' +
                ", img='" + img + '\'' +
                ", name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", category_id='" + category_id + '\'' +
                ", category_name='" + category_name + '\'' +
                '}';
    }
}

